package com.community.controller;
import com.community.dao.NoticeDao;
import com.community.dao.impl.NoticeDaoImpl;
import com.community.model.Notice;

import com.community.service.NoticeService;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/UserNotice")
public class UserNoticeController extends HttpServlet {
    private NoticeService noticeService = new NoticeService();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        List<Notice> notices = noticeService.getAllNotices();
        request.setAttribute("notices", notices);
        request.getRequestDispatcher("notice_view.jsp").forward(request, response); // 转发到公告管理页面
    }
}